window.onload = windowHeight; //页面载入完毕执行函数

function windowHeight() {
    var h = document.documentElement.clientHeight; //获取当前窗口可视操作区域高度
    var w=document.documentElement.clientWidth

    var i=document.getElementById("img");
    var m=document.getElementById("main")
    var bodyHeight = document.getElementById("content"); //寻找ID为content的对象

    console.log(h)
    console.log(w)
    bodyHeight.style.height = h + "px"; //你想要自适应高度的对象
    m.style.width=w*0.7+"px";
    m.style.height=h-100+"px";
    i.setAttribute("width",w);
    i.setAttribute("height",h);
}
